package com.meihua.workflow.constants;

import lombok.Data;




@Data
public class R<T> {


    /**
     *  //编码：200成功，0和其它数字为失败
     */
    private Integer code;

    /**
     * //信息
     */
    private String message;

    /**
     *   //数据
     */
    private T data;

//    private Map map = new HashMap();

    public static <T> R<T> success(T object) {
        R<T> r = new R<>();
        r.data = object;
        r.message="SUCCESS";
        r.code = 20000;
        return r;
    }
    public static <T> R<T> success() {
        return success(null);
    }
    public static <T> R<T> error(String message) {
        return error(50000,message);
    }
    public static <T> R<T> error(Integer code,String message) {
        R<T> r = new R<>();
        r.message = message;
        r.code = code;
        return r;
    }
//    public R<T> add(String key, Object value) {
//        this.map.put(key, value);
//        return this;
//    }

}
